package com.tpln.mapper;

import com.tpln.pojo.NodeInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NodeMapper {

    @Insert("insert into node_info(node_id,node_title,node_content,node_create_time,user_id) values( replace(UUID(),'-',''),#{param1},#{param2},now(),#{param3})")
    int addNode(String nodeTitle, String nodeContent,String userId);

    @Select("select node_id as nodeId,node_title,node_content,node_create_time,user_id from node_info where user_id = #{userId}")
    List<NodeInfo> selectNodeInfoByUserId(@Param("userId") String userId);

    @Select("select * from node_info where node_id = #{param1}")
    NodeInfo selectNodeInfoByNodeId(String nodeId);
}
